package com.jg.controller;

/**
 * @BelongsProject: smartapp
 * @BelongsPackage: com.jg.common
 * @Author: YangMaozhi
 * @CreateTime: 2024-11-21  00:39
 * @Description: 登陆、退出相关的控制器
 * @Version: 1.0
 */

import cn.hutool.core.util.StrUtil;
import com.jg.common.Result;
import com.jg.entity.User;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class AccountController {

    /**
     * @description: 登陆
     * @author: YangMaozhi
     * @date: 2024/11/21 00:38
     * @param: 
     * @return: 
     **/
    @PostMapping("/login")
    public Result<User> login(@RequestBody User user, HttpServletRequest request) {
        if(StrUtil.isBlank(user.getUsername()) || StrUtil.isBlank(user.getPassword())) {
            throw new RuntimeException();
        }

        // todo 从数据库查询账号是否正确，放到session
        return Result.success();

    }
}
